//package zack.project.config;
//
//import ch.qos.logback.classic.LoggerContext;
//import ch.qos.logback.classic.spi.ILoggingEvent;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import zack.monitor.sdk.appender.CustomAppender;
//import zack.monitor.sdk.push.IPush;
//import zack.monitor.sdk.push.impl.PushRedis;
//
///**
// * @author A1793
// */
//@Configuration
//@EnableConfigurationProperties({BusinessMonitorAutoProperties.class})
//public class AppenderConfig {
//
//    @Bean
//    @ConditionalOnProperty(
//            prefix = "business.behavior.monitor.config",
//            name = "enable",
//            havingValue = "true",
//            matchIfMissing = false
//    )
//    public CustomAppender<ILoggingEvent> customAppender(IPush pushRedis,
//                                                        BusinessMonitorAutoProperties monitorAutoProperties) {
//        CustomAppender<ILoggingEvent> customAppender = new CustomAppender<>();
//        customAppender.setSystemName(monitorAutoProperties.getSystemName());
//        customAppender.setGroupId(monitorAutoProperties.getGroupId());
//        customAppender.setHost(monitorAutoProperties.getHost());
//        customAppender.setPort(monitorAutoProperties.getPort());
//        customAppender.setPush(pushRedis);
//        customAppender.start();
//
//
//        LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
//        ch.qos.logback.classic.Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
//        rootLogger.addAppender(customAppender);
//        return customAppender;
//    }
//
//    @Bean
//    IPush pushRedis() {
//        return new PushRedis();
//    }
//
//
//}
